function load() {
    getServerInput("read.py", display);
}

function display(task_txt) {
    document.body.innerHTML = task_txt;
}

function getServerInput(path, handler) {
    var xml = new XMLHttpRequest();

    xml.open("GET", path);
    
    xml.onreadystatechange = function() {
        if (xml.readyState === 4 && xml.status === 200) {
            handler(xml.responseText);
        }
    }

    xml.send(null);
}

function toggleCheck(chBox) {
    getServerInput("read.py?id=" + chBox.id, display)
}

function falseLoad(none) {
    load();
}

function addTask(button) {
    n = document.getElementById(button.id.replace("submit", "name"));
    getServerInput("addTask.py?id=" + button.id +
		   "&name=" + n.value, falseLoad);
}
